package edu.uta.cse6339.facetedinterface.util;

import java.util.HashMap;
import java.util.Set;

public class StateAggrAssaultRangeValues {

	private static final String StateAggrAssaultFile ="src/edu/uta/cse6339/facetedinterface/resources/StateAssaultRange";
	
	private static HashMap<Integer,Set<String>> stateRange = null;
	private static Integer stateRangeKey [] = null;
	
	private static int MAX_RANGE_VALUE=100000;
	private static int MIN_RANGE_VALUE=100;
	
	private StateAggrAssaultRangeValues(){
		
	}
	
	
	public static void initialiseRange(){
		stateRange =ProcessRange.readRangeFile(StateAggrAssaultFile);
		stateRangeKey=ProcessRange.sortRangeKeyValues(stateRange);
	}
	
	
	public static Set<String> getRangeValues(int value){
		int rangeKey=0;
		Set<String> states=null;
	    float newValue = (((float)value)/(100))*(MAX_RANGE_VALUE);
		if(stateRangeKey!=null && stateRangeKey.length>0){
			for(Integer key : stateRangeKey){
				rangeKey =key;
				if(key>=(int)newValue){
					break;
				}		
			}
			states=stateRange.get(rangeKey);
		}
		return states;
	}

	
	public static void main(String args[]){
		initialiseRange();
		System.out.println(getRangeValues(9));
	}

}
